# -*- coding:utf-8 -*-
# @File       :   waitOpt.py
# @Author     :   LINING
# @Time       :   2024/7/22 14:37
# @Description : 等待操作
from Handle.handle_log import log


class Wait:
    def __init__(self, page):
        self.page = page

    # 强制等待,不阻塞异步请求，不会影响监听
    def wait_time(self, seconds):
        try:
            self.page.wait_for_timeout(seconds * 1000)
            log.log_info(f'等待{str(seconds)}秒成功')
        except Exception as e:
            log.log_error(f'等待{str(seconds)}失败，错误信息：{e}')
            raise e
